Extract C++ FFI equivalence harness into a separate crate#2
Merged
Conversation
Move everything that links the original MaxBin2 C++ for FFI-based equivalence testing out of the core maxbin-rs crate and into a new crates/maxbin-rs-equivalence crate. The core crate now has no build.rs and no cc / C++ dependency, so it can eventually compile to wasm. What moved to crates/maxbin-rs-equivalence: - build.rs and vendor/ (C++ extract, patch, and cc compile) - src/original_ffi.rs (FFI bindings), re-exported from the crate's lib.rs - the cpp-em capability, now the standalone maxbin-rs-cpp-em binary (it was only ever a maxbin-rs subcommand for equivalence testing) - the FFI-comparing integration tests and proptests, plus the divergent-em fixture - the in-source ffi_* / equivalence_* unit tests, relocated as integration tests that drive the core crate's public API The new crate depends on maxbin-rs as a path dependency. No core API needed widening: the moved tests already used public functions (distance, kmer_map, profiler, emanager, fasta, abundance, quicksort). Build wiring: the maxbin-rs and maxbin-rs-em packages now build only -p maxbin-rs (coreArgs, no MAXBIN2_SRC_TARBALL). The workspace-wide clippy and nextest checks still set the tarball because they span both crates. The C++ LTO A/B benchmark and EM disassembly now use two new equivalence-crate binaries (maxbin-rs-cpp-em, maxbin-rs-cpp-em-lto) instead of the former maxbin-rs-lto. This is pure code reorganization: the binning output of maxbin-rs on a given input is unchanged.
…m binary The equivalence-crate extraction moved the original C++ EM out of the maxbin-rs `cpp-em` subcommand into a standalone maxbin-rs-cpp-em binary, but two test paths still pointed at the old subcommand: - pipeline-stages.sh Stage 4 called `maxbin-rs cpp-em`, which no longer exists. Switched to the maxbin-rs-cpp-em binary (same flags). The stage test stays: its EM comparison is single-shot via FFI, so it sidesteps the recursive ULP divergence that makes full end-to-end comparison flaky in degenerate cases. - disasm-em pulled all four EM hot functions from the cpp-em binary, but that binary never calls the Rust EM, so run_em and compute_abund_prob_for_contig get dead-code-eliminated and the disasm silently degraded to "symbol not found". Pull the Rust functions from the maxbin-rs-em binary (unwrapped, runs the Rust EM via its pipeline) and keep the C++ functions on the cpp-em std/LTO binaries, which is the only axis the A/B actually varies.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pulls the original-MaxBin2 C++ and its FFI equivalence harness out of
maxbin-rsinto a newmaxbin-rs-equivalencecrate. The core now builds with nobuild.rsand nocc, which is the prerequisite for targeting wasm.What moved:
build.rs+vendor/(the C++ extract/patch/compile),original_ffi.rs, the oldcpp-emsubcommand (now amaxbin-rs-cpp-embinary in the new crate), and the FFI and equivalence tests. The new crate path-depends onmaxbin-rs; nothing in core had to be made more public.No binning-output change: the only deletions from core are test functions, moved verbatim, and the EM itself is untouched.
One incidental fix rode along:
bench-cpp-ltoanddisasm-emcarried single-dash flags broken since v0.3, switched to double-dash while repointing them at the new binaries.